<template>
	<view class="user-page">
		<view class="top-user-msg">
			<view class="main-bg"></view>
			<view class="user-detail-box">
				<view class="top-box">
					<view class="left-box">
						<image class="img" :src="usermsg.head_portrait" mode=""></image>
						<view class="name-and-grade">
							<text class="name">{{usermsg.nickname || ''}}</text>
							<text class="vip">{{usermsg.member_level}}</text>
						</view>
					</view>
					<view class="right-box">
						<text class="iconfont iconicon-fx"></text>
						<text>分享给朋友</text>
					</view>
				</view>
				<view class="content-box my-assets">
					<view class="top-title">
						我的资产
					</view>
					<view class="center-cash">
						<view class="item-cell">
							<view class="num">￥{{usermsg.total_revenue || "0.00"}}</view>
							<view class="title">总收益</view>
						</view>
						<view class="item-cell">
							<view class="num">￥{{usermsg.balance || "0.00"}}</view>
							<view class="title">余额</view>
						</view>
						<view class="item-cell">
							<view class="num">￥{{usermsg.save || "0.00"}}</view>
							<view class="title">节省</view>
						</view>
						<view class="item-cell">
							<view class="num">{{usermsg.points || "0"}}</view>
							<view class="title">积分</view>
						</view>
					</view>
				</view>
			</view>
		</view>
		<view class="mk-group content-box">
			<view class="top-title">
				萌卡俱乐部
			</view>
			<view class="center-cash">
				<view class="item-cell">
					<view class="num">
						<text class="iconfont iconmoneycollect"></text>
					</view>
					<view class="title">收益攻略</view>
				</view>
				<view class="item-cell">
					<view class="num">
						<text class="iconfont iconfire-fill"></text>
					</view>
					<view class="title">今日推文</view>
				</view>
				<view class="item-cell">
					<view class="num">
						<text class="iconfont iconwodefensi"></text>
					</view>
					<view class="title">我的粉丝</view>
				</view>
				<view class="item-cell" @click="tolinkPage('../other/aboutmk')">
					<view class="num">
						<text class="iconfont icongem"></text>
					</view>
					<view class="title">关于萌卡</view>
				</view>
			</view>
		</view>
		<view class="join-we">
			<view class="h3">
				免费加入萌卡俱乐部
			</view>
			<view class="mian">
			    <text class="more">更多优惠</text>	分享就能赚钱
				<text class="iconfont icongengduo"></text>
				<text class="iconfont icongengduo"></text>
				<text class="iconfont icongengduo"></text>
			</view>
		</view>
		<view class="my-serve mk-group content-box">
			<view class="top-title">
				我的服务
			</view>
			<view class="center-cash">
				<view class="item-cell">
					<view class="num">
						<text class="iconfont iconbangzhu"></text>
					</view>
					<view class="title">帮助与客服</view>
				</view>
				<view class="item-cell">
					<view class="num">
						<text class="iconfont iconfankui"></text>
					</view>
					<view class="title">投诉反馈</view>
				</view>
				<view class="item-cell" @click="tolinkPage('../basic/usermsg')">
					<view class="num">
						<text class="iconfont icongerenxinxi"></text>
					</view>
					<view class="title">个人信息</view>
				</view>
				<view class="item-cell" @click="outLogin()">
					<view class="num">
						<text class="iconfont icontuichu"></text>
					</view>
					<view class="title">退出登录</view>
				</view>
			</view>
		</view>
		<!-- #ifdef MP-WEIXIN -->
		<van-toast id="van-toast" />
		<!-- #endif -->
	</view>
</template>
<script>
// #ifdef MP-WEIXIN
import Toast from '@/wxcomponents/vant-weapp/toast/toast.js';
// #endif
import { getMyaccountApi } from "@/api/getdata";
export default {
	name:"orderPage",
	data(){
		return {
			usermsg:{}
		}
	},
	onLoad(){
		this._initData();
		this.$setTopBar({title:"我的"});
	},
	methods:{
		async _initData(){
			try {
				let phone = this.$store.state.phone_no;
				uni.showLoading({title:"加载中"});
				let data = await getMyaccountApi({
					phone_no:phone,
				});
				this.usermsg = data;
				uni.hideLoading();
			} catch (e) {
				uni.hideLoading();
				// #ifdef MP-WEIXIN
				Toast.fail(e.errMsg);
				// #endif
			}
		},
		tolinkPage(url){
			this.$router({url})
		},
		outLogin(){
			this.$alert({
				title:"提示",
				content:"是否要退出登录"
			}).then(()=>{
				
			}).catch(()=>{})
		}
	}
}
</script>
<style lang="scss" scoped>
	@import "./style/user.scss";
</style>
